#version 460




layout(location = 1) in VS_FS_VERTEX {
	vec4	vColor;
	flat ivec3	vUV_Offset;
	flat ivec2	vUV_Bound;
};

layout(location=0) out vec4 outColor;


layout(binding = 10) uniform sampler2DArray tex;

void main(void){
	vec3 uv = vec3(gl_PointCoord * (vUV_Bound.y), vUV_Offset.z);
	//outColor = vec4(uv/vUV_Bound.y, 1);
	uv.xy += vUV_Offset.xy * vUV_Bound.y;
	
	//uv = gl_PointCoord * vUV_Bound.y
	//vec3 uv = vec3(gl_PointCoord + vUV_Offset.xy, vUV_Offset.z);  + vUV_Offset.xy
	//outColor = vec4(1, 1, 1, textureLod(tex, uv, 0).r);
	//outColor = vec4(1, 1, 0, textureLod(tex, uv, 0).a);
	//outColor = textureLod(tex, vec3(gl_PointCoord, 0), 0);
	//outColor = texture(tex, vec3(gl_PointCoord*0.01 + 0.2, 0));
	//outColor = texture(tex, uv);
	float a = texelFetch(tex, ivec3(uv), 0).r;
	outColor = vec4(vColor.rgb, a * 1.3);
	
	//outColor = vec4(gl_PointCoord*vUV_Offset.xy, 0, 1);
}

 